package com.kk.xhr.common.pojo;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * 签到状态枚举
 *
 * @author luokexiong
 * @version 1.0 2021/2/18
 * @since 1.0.0
 */
@Getter
@AllArgsConstructor
public enum ApplyStatusEnum {
    APPLYING((byte) 0),
    PASS((byte) 1),
    REVOKE((byte) 2),
    FAIL((byte) 3);

    /** map */
    private static final Map<Byte, ApplyStatusEnum> map = Arrays.stream(ApplyStatusEnum.values())
        .collect(Collectors.toMap(ApplyStatusEnum::getValue, Function.identity()));
    private final byte value;

    /**
     * 转换工具
     *
     * @param status 状态
     * @return SignStatusEnum
     */
    public static ApplyStatusEnum from(Byte status) {
        return map.getOrDefault(status, FAIL);
    }

}
